package com.archermind.boc.xml.parser.impl;

import com.archermind.boc.domain.Presence;
import com.thoughtworks.xstream.XStream;

public class PresenceProcessor extends BaseProcessor {
	private XStream xstream;

	public XStream getXstream() {
		return xstream;
	}

	public void setXstream(XStream xstream) {
		this.xstream = xstream;
	}

	@Override
	public void doBack(Object object) {
		Presence presence = (Presence) object;
		getDispatch().dispatch(presence);
	}

	@Override
	public Object parse(String sessionID, String xml) throws Exception {
		Presence presence = (Presence) xstream.fromXML(xml);
		presence.setSessionID(sessionID);
		return presence;
	}

}
